stage.set_background("subway")
sprite = codesters.Sprite("person10")
sprite.move_down(75)
sprite.flip_up_down()
sprite.move_right(200)
sprite.move_left(150)
sprite.flip_up_down()
stage.wait(2)
sprite.move_up(50)
sprite.turn_left(360)
sprite.move_down(50)
stage.wait(2)
sprite.flip_right_left()
stage.wait(1)
try:
tval1 = sprite.get_flip()
except:
tval1 = "DNE"
try:
tval2 = stage.get_wait_time()
tval2a = stage.get_total_wait_time()
except:
tval2 = "DNE"
tval2a = "DNE"
t1 = TestObjective()
t1.add_success(tval1 is False, "Great Job!")
t1.add_failure(tval1 is True, "Did you make the sprite flip to the left again?")
t1.add_failure(tval1 == "DNE", "Did you delete the sprite?")
t2 = TestObjective()
t2.add_success(tval2 == 1 and tval2a > 5, "Great Job!")
t2.add_failure(tval2 == 2 and tval2a <= 5, "Did you add another wait command?")
t2.add_failure(tval2a == 7, "Did you change the number in wait?")
t2.add_failure(tval2a == 5, "Did you add another wait command?")
t2.add_creative(tval2 != 1 and tval2a != 8 and tval2 != 2 and tval2 != "DNE", "That is a good wait time!")
t2.add_default("Creative choice!")
#print tval1
#print tval2
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)